package com.yao.mall.common;

import com.yao.mall.model.vo.UserVO;

/**
 * @author jiahua.yao
 * @version 1.0
 * @description theadLocal信息存储传输类
 * @date 2024/3/1 14:20
 */
public class UserHolder {
    private static final ThreadLocal<UserVO> tl = new ThreadLocal<>();

    public static void saveUser(UserVO user){
        tl.set(user);
    }

    public static UserVO getUser(){
        return tl.get();
    }

    public static void removeUser(){
        tl.remove();
    }
}
